//
//  DHUserModel.m
//  GoBangGraduationProject
//
//  Created by 叶敦聪 on 2017/9/10.
//  Copyright © 2017年 dahua. All rights reserved.
//

#import "DHUserModel.h"

@implementation DHUserModel
MJCodingImplementation
- (void)setUserLevel:(DHUserLevel)userLevel {
    _userLevel = userLevel;
    
    switch (_userLevel) {
        case 0:
            _userLevelDesc = ATLocalizedString(@"YingCai_Grade_1", @"盈彩一段");
            break;
        case 1:
            _userLevelDesc = ATLocalizedString(@"YingCai_Grade_2", @"盈彩二段");
            break;
        case 2:
            _userLevelDesc = ATLocalizedString(@"YingCai_Grade_3", @"盈彩三段");
            break;
        case 3:
            _userLevelDesc = ATLocalizedString(@"YingCai_Grade_4", @"盈彩四段");
            break;
        case 4:
            _userLevelDesc = ATLocalizedString(@"YingCai_Grade_5", @"盈彩五段");
            break;
        default:
            break;
    }
}

- (void)setGrade:(NSInteger)grade {
    _grade = grade;
    
    if (_grade > 150) {
        self.userLevel = 4;
    }
    else if (_grade > 100) {
        self.userLevel = 3;
    }
    else if (_grade > 60) {
        self.userLevel = 2;
    }
    else if (_grade > 20) {
        self.userLevel = 1;
    }
    else {
        self.userLevel = 0;
    }
}

@end
